package com.aabte.design.pattern.behavioral.observer;

public class Test {

    public static void main(String[] args) {

        Course course = new Course("Java");
        Teacher teacher1 = new Teacher("Alpha");
        Teacher teacher2 = new Teacher("Beta");

        course.addObserver(teacher1);
        course.addObserver(teacher2);


        Question question = new Question();
        question.setUserName("tom");
        question.setQuestionContent("Java如何函数式编程");

        course.produceQuestion(course, question);


        /*
        tom在Java上提交了一个问题
        Beta老师的Java课程接收到一个tom提交的问题：Java如何函数式编程
        Alpha老师的Java课程接收到一个tom提交的问题：Java如何函数式编程
         */
    }

}
